<?php 
$this->Html->styleBlock("
	dl.gallery { margin-top: 10px; }
	dl.gallery dt { display: inline; margin: {$params_left['margin']}px; padding: 2px; z-index: 90; width: ".($params_left['width']+$params_left['padding']*2)."px; height: ".($params_left['height']+$params_left['padding']*2)."px;  text-align: center; float: left; border-radius:8px; -moz-border-radius:8px; -webkit-border-radius:8px; border: solid 1px #ccc; background: #fff; }
	dl.gallery dt a.highslide { display: block; width: {$params_left['width']}px; height: {$params_left['height']}px; padding: {$params_left['padding']}px;  border: solid {$params_left['border']}px #eee; background-position: center; background-repeat: no-repeat; float: left; overflow: hidden; text-decoration:none;}
	dl.gallery  dt a.highslide:hover { padding: {$params_left['padding']}px; text-decoration:none; }
	dl.gallery dt a img.hidden_thumb { display:none; }
",array('inline'=>false));
?>
<?php 
if($session->check('Auth.User.id')){
	if($session->read('Auth.User.group') == 'admin' || $session->read('Auth.User.group') == 'manag')
	$this->Html->styleBlock("
		ul.file_toolbar { display: block; position: absolute; background: url(../../img/firma/bg_toolbar.png) repeat; margin: ".($params_left['border']+3)."px;  z-index: 1000; float: none; }
		ul.file_toolbar li { display: block; float: left; width: 16px; height: 16px; margin: 3px; padding: 2px; background: url(../../img/firma/bg_toolbar.png) repeat; }
		ul.file_toolbar li a { display: block; padding: 0px; margin: 0px; width: 16px; height: 16px; }
		ul.file_toolbar li a img { padding: 0px; margin: 0px;  }
		ul.file_toolbar li:hover { background: #fff; }
	",array('inline'=>false));
}?>



<?php if(is_array($items) && !empty($items)){?>

<dl class="gallery clearfix">



<?php foreach ($items as $key => $photo) {?>
<dt class="corners-left-top corners-right-top corners-left-bottom corners-right-bottom border">	
	<?php 
		if($session->check('Auth.User.id')){
			if($session->read('Auth.User.group') == 'admin' || $session->read('Auth.User.group') == 'manag'|| $session->read('Auth.User.group') == 'emplo')
			echo $this->element('file_toolbar',array('plugin' => 'gallery','category_id'=>$category_id,'gallery_id'=>$photo['Gallery']['id']));
		}
		
	?>
	<?php
		$file = $fileUpload->image($photo['Upload']['name'],array('autoResize'=>true,'imagePathOnly'=>true,'class'=>'large','alt'=> $photo['Gallery']['name'],'width'=>800,'height'=>800));
		$thumb = $fileUpload->image($photo['Upload']['name'],array('autoResize'=>true,'imagePathOnly'=>true,'class'=>'thumb','alt'=> $photo['Gallery']['name'],'width'=>$params_left['width'],'height'=>$params_left['height']));
		$thumb_ = $fileUpload->image($photo['Upload']['name'],array('autoResize'=>true,'imagePathOnly'=>false,'class'=>'hidden_thumb','alt'=> $photo['Gallery']['name'],'width'=>$params_left['width'],'height'=>$params_left['height']));
	
		$ext = strtolower($fileUpload->_getExt());
		 
		if($ext == '.jpg' || $ext == '.jpeg'  || $ext == '.gif' || $ext == '.png' || $ext == '.bmp'){
			
	?>
	<?php 
		$title = str_replace("\"","'",($photo['Gallery']['name']));
		echo $html->link($thumb_,	   	
		$file,array('escape'=>false,'class'=>"highslide",  'onclick'=>"return hs.expand(this,{captionText: '{$title}',slideshowGroup:'galeria-strzyzow'})",'style'=>"background: url(".$thumb.") center no-repeat;"))?>
	<?php }else{?>
	<?php 
		if($ext == '.mov' || $ext == '.swf'  || $ext == '.flv' || $ext == '.avi' || $ext == '.mpg' || $ext == '.mpeg'){
			$rel = 'rel="prettyPhoto[gallery]"';
		}else{
			$rel = '';
		}
	?>
	<a href="<?php echo $file;?>" class="highslide" title="<?php echo $photo['Gallery']['name']?>" <?php echo $rel?> style="background: #fff; vertical-align: middle; "><br/><br/><?php echo '( '. $photo['Upload']['name'].' ) <br/><br/> <span style="text-decoration: none;  font-weight: normal;">'. $photo['Gallery']['name'].'</span>';?></a>
	<?php }?>	
</dt>
<?php }?>
</dl>
<?php }?>
<div class="clr"></div>
<?php 
if($session->check('Auth.User.id')){
	if($session->read('Auth.User.group') == 'admin' || $session->read('Auth.User.group') == 'manag'|| $session->read('Auth.User.group') == 'emplo')
	echo '<div>'.$this->element('toolbar',array('plugin' => 'gallery','category_id'=>$category_id)).'</div>';
}
?>


